package model.houseproject_commity.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;


import model.houseproject_commity.entity.Commity;
import model.houseproject_commity.mapper.CommityMapper;
import model.houseproject_commity.service.CommityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by ws on 2019/6/23.
 */
@Service
@Transactional
public class commityServiceImpl implements CommityService {
    @Autowired
    private CommityMapper commityMapper;
    @Override
    public List<Commity> findAlls() {
        return commityMapper.findAlls();
    }

    @Override
    public void save(Commity commity) {
       commityMapper.save(commity);
    }

    @Override
    public void del(Integer id) {
        commityMapper.del(id);
    }

    @Override
    public void update(Commity commity) {
        commityMapper.update(commity);
    }

    @Override
    public void findid(Integer id) {

    }

    @Override
    public List<Commity> findAll(String subway) {
        return commityMapper.findAll(subway);
    }

    @Override
    public PageInfo<Commity> getPageInfo(String subway, Integer pageNow, Integer pageSize) {
        PageHelper.startPage(pageNow==null?1:pageNow,pageSize==null?3:pageSize);
        List<Commity> commityList=commityMapper.findAll(subway==null?"":subway.trim());
        PageInfo<Commity> pageInfo=new PageInfo<>(commityList);
        return pageInfo;
    }

    @Override
    public List<Commity> findaddress(String address) {
        return commityMapper.findaddress(address);
    }

    @Override
    public List<Commity> checkboxfind(String commityaddress, String type, String subway) {
        return commityMapper.checkboxfind(commityaddress,type,subway);
    }


}





